home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_1.3 / Read-Me1.3 / A2024Docs / OpenA2024.c < prev   
Encoding:
C/C++ Source or Header  |  1988-02-11  |  3.7 KB  |  138 lines

  1.  
  2. /* opena2024.c -- development test of opening a2024 screen    */
  3.  
  4. #include <exec/types.h>
  5. #include <intuition/intuition.h>
  6.  
  7. #define NONEWINCLUDES        1    /* don't have 1.3 includes yet    */
  8.  
  9.  
  10. #if NONEWINCLUDES        /* Some additional definitions    */
  11.  
  12. /********** from intuition/screens.h ************/
  13.  
  14. #define NS_EXTENDED     0x1000     /* NewScreen.Extension is valid        */
  15.  
  16. struct TagItem
  17. {
  18.     ULONG    ti_Tag;        /* identifies the type of this item    */
  19.     ULONG    ti_Data;    /* type-specific data, can be a pointer    */
  20. };
  21.  
  22. /* ----    system tag values -----------------------------    */
  23. #define TAG_DONE   (0L)    /* terminates array of TagItems. ti_Data unused    */
  24. #define    TAG_IGNORE (1L)    /* ignore this item, not end of array        */
  25. #define    TAG_MORE   (2L)    /* ti_Data is pointer to another array of TagItems
  26.              * note that this tag terminates the current array
  27.              */
  28.  
  29. /* ----    user tag identification -----------------------    */
  30. #define TAG_USER  (1L<<31)    /* differentiates user tags from system tags*/
  31.  
  32. /* until further notice, tag bits 16-30 are RESERVED and should be zero.
  33.  * Also, the value (TAG_USER | 0) should never be used as a tag value.
  34.  */
  35.  
  36.  
  37. /* ----    tag values special to NewScreen.Extension -----    */
  38. #define NSTAG_EXT_VPMODE (TAG_USER | 1)
  39. /* ti_Data specifies data for ViewPort.ExtendedMode (ZZZ name?)    */
  40.  
  41. #define NewScreen tempNewScreen
  42.  
  43. /* this is the extended NewScreen from the new screens.h    */
  44. struct tempNewScreen
  45. {
  46.     SHORT LeftEdge, TopEdge, Width, Height, Depth;  /* screen dimensions */
  47.  
  48.     UBYTE DetailPen, BlockPen;    /* for bar/border/gadget rendering    */
  49.  
  50.     USHORT ViewModes;        /* the Modes for the ViewPort (and View) */
  51.  
  52.     USHORT Type;        /* the Screen type (see defines above)    */
  53.     
  54.     struct TextAttr *Font;    /* this Screen's default text attributes */
  55.     
  56.     UBYTE *DefaultTitle;    /* the default title for this Screen    */
  57.     
  58.     struct Gadget *Gadgets;    /* your own Gadgets for this Screen    */
  59.     
  60.     /* if you are opening a CUSTOMSCREEN and already have a BitMap 
  61.      * that you want used for your Screen, you set the flags CUSTOMBITMAP in
  62.      * the Type field and you set this variable to point to your BitMap
  63.      * structure.  The structure will be copied into your Screen structure,
  64.      * after which you may discard your own BitMap if you want
  65.      */
  66.     struct BitMap *CustomBitMap;
  67.  
  68.     struct TagItem    *Extension;
  69.                 /* more specification data, scanned if
  70.                  * NS_EXTENDED is set in NewScreen.Type
  71.                  */
  72. };
  73.  
  74.  
  75. /********** from graphics/view.h ****************/
  76. #define VPF_A2024        0x40
  77. #define VPF_AGNUS        0x20
  78. #define VPF_TENHZ        0x20
  79.  
  80.  
  81. #endif    NONEWINCLUDES
  82.  
  83.  
  84.  
  85. struct TextAttr SafeFont =
  86.     {
  87.     "topaz.font",
  88.     8,
  89.     0,
  90.     0,
  91.     };
  92.  
  93.  
  94. /* This is the smallest case of the proposed data extension 
  95.  * For now, use exactly this format, and the final scheme will
  96.  * be compatible with this.
  97.  * These structures and definitions are in intuition/screens.h
  98.  * for now, but may be moved.
  99.  *
  100.  * ViewPort extended modes flag VPF_A2024 defined in
  101.  * graphics/viewport.h. 
  102.  */
  103. struct TagItem    nsextension[] = {
  104.     { NSTAG_EXT_VPMODE, VPF_A2024},
  105.     { TAG_DONE, 0}
  106. };
  107.  
  108.  
  109. struct Screen *
  110. OpenA2024Screen()
  111. {
  112.     struct NewScreen    ns;
  113.  
  114.     ns.LeftEdge        =    0;
  115.     ns.TopEdge        =    0;
  116.     ns.Width        =    1008;
  117.     ns.Height        =    800;
  118.     ns.Depth        =    1;    /* can use 1 or 2    */
  119.     ns.DetailPen     =    0;
  120.     ns.BlockPen        =    1;
  121.     ns.ViewModes     =    HIRES;    /* determined above    */
  122.  
  123.     /* Note that NS_EXTENDED is set to indicate data in ns.Extension    */
  124.     ns.Type        =    CUSTOMSCREEN | NS_EXTENDED;
  125.  
  126.     ns.Font        =    &SafeFont;
  127.     ns.DefaultTitle    =    " A2024 Test Screen ";
  128.     ns.Gadgets        =    NULL;
  129.     ns.CustomBitMap    =    NULL;
  130.  
  131.     /* supply extended specification here    */
  132.     ns.Extension     =    nsextension;
  133.  
  134.     return ((struct Screen *) OpenScreen(&ns));
  135. }
  136.  
  137. /* end */
  138.